package framework.aop.spring.helloworld;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

//import framework.aop.spring.helloworld.impl.ArithmeticCalculatorImpl;
//import framework.aop.spring.helloworld.invocationhandler.CalculatorLoggingHandler;

public class Main {

	/**
	 * @param args
	 * @throws InterruptedException 
	 */
	public static void main(String[] args) throws InterruptedException {
//		ArithmeticCalculator arithmeticCalculatorImpl = new ArithmeticCalculatorImpl();
//		ArithmeticCalculator arithmeticCalculator = (ArithmeticCalculator) CalculatorLoggingHandler.createProxy(arithmeticCalculatorImpl);
//		
//		arithmeticCalculator.add(1, 2);
		ApplicationContext springContext = new ClassPathXmlApplicationContext("bean.xml");
		ArithmeticCalculator arithmeticCalculator = (ArithmeticCalculator) springContext.getBean("arithmeticCalculatorProxy");
		UnitCalculator unitCalculator = (UnitCalculator)springContext.getBean("unitCalculator");
		
		Thread.sleep(1000);
		
		System.out.println();
		System.out.println();
		
		arithmeticCalculator.add(1, 2);
	}

}
